package net.midnighttd.game.view;

import net.midnighttd.engine.Engine;
import net.midnighttd.engine.view.EngineView;
import net.midnighttd.game.MidnightTD;

import javax.swing.*;
import java.awt.*;

/**
 * Author: Adam Scarr
 * Date: 22/04/2009
 * Time: 1:02:26 PM
 */
public class SwingUI extends JFrame implements MainUI  {
    private Sidepanel side;
    private MidnightTD game;

    public SwingUI(MidnightTD game) {
        super("Midnight Tower Defence v0.6");

        this.game = game;
        add(new MidnightTDView(this), BorderLayout.CENTER);
        side = new Sidepanel(this);

        add(new StatBar(this), BorderLayout.NORTH);
        add(side, BorderLayout.EAST);
        setVisible(true);
        pack();
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        game.start();
    }

    public TowerSelector getTowerSelector() {
        return side.getTowerSelector();
    }

    public MidnightTD getGame() {
        return game;
    }

    public Sidepanel getSidepanel() {
        return side;
    }
}
